<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Home extends CI_Controller {

	public function __construct() {
		parent::__construct();
	}

	public function index() {
		// echo $this->config->base_url();
		$aryIndentifier = array(
			'file_name'		=>	'./application/sql/home/home.sql',
			'param'			=>	'select_poem'
		);

		$this->load->model('home/Connectionmodel');
		$this->Connectionmodel->loadDatabase();
		$aryView['poem'] = $this->Connectionmodel->executeQuery($aryIndentifier);
		$this->Connectionmodel->closeDatabase();
		// echo $this->uri->segment(4);

		$this->load->view("frontend/index", $aryView);
	}

	public function viewPoem() {
		$id = $this->uri->segment(4);
		$aryIndentifier = array(
			'file_name'		=>	'./application/sql/home/home.sql',
			'param'			=>	'select_view_poem'
		);

		$aryBin = array($id);

		$this->load->model('home/Connectionmodel');
		$this->Connectionmodel->loadDatabase();
		$aryView = $this->Connectionmodel->executeQuerySingle($aryIndentifier, $aryBin);
		$this->Connectionmodel->closeDatabase();

		// var_dump($aryView);

		$this->load->view("frontend/page", $aryView);
	}
}
